package com.study.d6_exception;

import java.io.FileInputStream;
import java.text.SimpleDateFormat;
import java.util.Date;

public class ExcepHandle {
    //目标：异常的处理机制
    public static void main(String[] args) {
        try {
            parseDate("2025-02-19 15:24:00");
            System.out.println("转换成功");
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("转换失败");
        }

    }

    private static void parseDate(String s) throws Exception {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy--dd HH:mm:ss");
        //编译时异常，运行时就报错
        Date parse = sdf.parse(s);
        System.out.println(parse);

        FileInputStream fis = new FileInputStream("D:/广东工业大学学生课程退选申请表格.doc");
    }
}
